package cn.kicsy.www.anonymous_bbs.repository;

import cn.kicsy.www.anonymous_bbs.entity.Notification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface NotificationRepository extends JpaRepository<Notification, Long> {
    // 获取指定IP地址的未读通知列表，按创建时间降序排列
    List<Notification> findByRecipientIpAddressAndReadFalseOrderByCreatedAtDesc(String recipientIpAddress);
    
    // 获取指定IP地址的所有通知列表，按创建时间降序排列
    List<Notification> findByRecipientIpAddressOrderByCreatedAtDesc(String recipientIpAddress);
}